<template>
  <div class="app-container menu">
    <div style="margin-bottom: 20px">
      <el-button type="primary" @click="dialogVisible = true">
        添加菜单
      </el-button>
    </div>

    <el-form :model="form">
      <el-form-item label="菜单图标">
        <el-col :span="8" :xs="24" style="position: relative;" @mouseleave="showChooseIcon = false">
          <SelectIcon v-model="form.icon" />
        </el-col>
      </el-form-item>
    </el-form>

    <el-dialog v-model="dialogVisible" title="添加菜单">
      <el-form :model="form">
        <el-col :span="12" :xs="24" @mouseleave="showChooseIcon = false">
          <el-form-item label="菜单图标">
            <SelectIcon v-model="form.icon" />
          </el-form-item>
        </el-col>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="dialogVisible = false">取消</el-button>
          <el-button type="primary" @click="dialogVisible = false">确认</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script setup>
import { ref, reactive } from 'vue'
import SelectIcon from '@/components/SelectIcon/index.vue'

const dialogVisible = ref(false)

const form = reactive({
  icon: ''
})

const showChooseIcon = ref(false)

</script>

<style lang="scss" scoped>
.menu {
  padding: 15px;
}
</style>
